package base.iterator.vctor;

import java.util.Iterator;
import java.util.Vector;

public class WaterShelf implements Aggregate{

    private Vector<Water> waters;


    public WaterShelf(){
        waters=new Vector<>();
    }

    public int getLength(){
        return waters.size();
    }

    public void appendWater(Water water){
        this.waters.add(water);
    }

    public Water getWater(int index){
        return waters.get(index);
    }

    @Override
    public Iterator iterator() {
        return new WaterShelfIterator(this);
    }
}
